public class FinalValueAfterOperations {
    public int finalValueAfterOperations(String[] operations) {
        int x = 0;
        for (String operation : operations) {
            if (operation.equals("++X") || operation.equals("X++")) {
                x++;
            } else if (operation.equals("--X") || operation.equals("X--")) {
                x--;
            }
        }
        return x;
    }

    public static void main(String[] args) {
        FinalValueAfterOperations f = new FinalValueAfterOperations();  
        String[] operations = {"++X", "X++", "--X", "X--"};  
        int finalValue = f.finalValueAfterOperations(operations);  
        System.out.println("Final value after operations: " + finalValue);
    }
}
